package com.qing.springcloud.exception;

/**
 * @author caozhipeng
 * @date 2025/7/10
 */
public class BusinessException extends RuntimeException {

    private Integer code;
    private String  message;
    public BusinessException(ExceptionTypeEnum typeEnum) {
        super(typeEnum.getMessage());
        this.message = typeEnum.getMessage();
        this.code = typeEnum.getCode();
    }

    public BusinessException(String message) {
        this.message =message;
        this.code = 500;
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
